package com.dianping.cat.home.group.transform;

import com.dianping.cat.home.group.entity.Domain;
import com.dianping.cat.home.group.entity.DomainGroup;
import com.dianping.cat.home.group.entity.Group;
import org.xml.sax.Attributes;



public class DefaultSaxMaker
  extends Object
  implements IMaker<Attributes>
{
  public Domain buildDomain(Attributes attributes) {
/* 15 */     String id = attributes.getValue("id");
/* 16 */     return new Domain(id);
  }





/* 23 */   public DomainGroup buildDomainGroup(Attributes attributes) { return new DomainGroup(); }





  public Group buildGroup(Attributes attributes) {
/* 30 */     String id = attributes.getValue("id");
/* 31 */     return new Group(id);
  }





/* 38 */   public String buildIp(Attributes attributes) { throw new UnsupportedOperationException(); }



  protected <T> T convert(Class<T> type, String value, T defaultValue) {
/* 43 */     if (value == null || value.length() == 0) {
/* 44 */       return defaultValue;
    }

/* 47 */     if (type == Boolean.class || type == boolean.class)
/* 48 */       return (T)Boolean.valueOf(value); 
/* 49 */     if (type == Integer.class || type == int.class)
/* 50 */       return (T)Integer.valueOf(value); 
/* 51 */     if (type == Long.class || type == long.class)
/* 52 */       return (T)Long.valueOf(value); 
/* 53 */     if (type == Short.class || type == short.class)
/* 54 */       return (T)Short.valueOf(value); 
/* 55 */     if (type == Float.class || type == float.class)
/* 56 */       return (T)Float.valueOf(value); 
/* 57 */     if (type == Double.class || type == double.class)
/* 58 */       return (T)Double.valueOf(value); 
/* 59 */     if (type == Byte.class || type == byte.class)
/* 60 */       return (T)Byte.valueOf(value); 
/* 61 */     if (type == Character.class || type == char.class) {
/* 62 */       return (T)Character.valueOf(value.charAt(0));
    }
/* 64 */     return (T)value;
  }
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/classes/!/com/dianping/cat/home/group/transform/DefaultSaxMaker.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */